It was replaced with the new discount.out
created for this run of the program.
Sometimes you want to run a program several times and put the output of all the runs into a single file. For example, say that you want the discounted price of several items to be saved in one file. Here is how to do this:
C:\users\default\JavaLessons>java Discount > discount.out 100 10 C:\users\default\JavaLessons>java Discount >> discount.out 200 20 C:\users\default\JavaLessons>java Discount >> discount.out 47 15 C:\users\default\JavaLessons>
The double "greater than" signs >>
mean to add the new output to the end of the file
discount.out
.
This is called concatenation of the output to a file.
Here is what the file now looks like:
C:\users\default\JavaLessons>type discount.out Enter list price in cents: Enter discount in percent: Discount Price: 90 Enter list price in cents: Enter discount in percent: Discount Price: 160 Enter list price in cents: Enter discount in percent: Discount Price: 40 C:\users\default\JavaLessons>
After all the above has been done, what would be the result of the command:
C:\users\default\JavaLessons>java Discount > discount.out